<?php
include"config.php";

$id = $_GET['id'];

$kueri = mysql_query("select * from tbl_weapon where id_weapon = '$id'");
while($data = mysql_fetch_array($kueri)){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PB WEAPON &amp; ITEM LIBRARY</title>
</head>

<body>
<form action="proses_edit_weapon.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <table width="500" border="1" align="center" cellpadding="1" cellspacing="1">
    <tr>
      <td colspan="3" align="center">Edit Weapon</td>
    </tr>
    <tr>
      <td>Picture</td>
      <td>:</td>
      <td><label for="picture"></label>
      <input type="file" name="picture" id="picture" /><img  src="assets/picture/<?=$data['picture'];?>" width="242" /></td>
    </tr>
    <tr>
      <td>Item Name</td>
      <td>:</td>
      <td><label for="item_name"></label>
      <input name="item_name" type="text" id="item_name" value="<?=$data['item_name'];?>" /></td>
    </tr>
    <tr>
      <td>Cattegory</td>
      <td>:</td>
      <td>
        <select name="cattegory" id="cattegory">
          <option value="riffle" <?php if($data['cattegory'] == 'riffle'){ echo"selected=\"selected\" "; } ?> >Riffle</option>
          <option value="smg" <?php if($data['cattegory'] == 'smg'){ echo"selected=\"selected\" "; } ?>>SMG</option>
          <option value="awp" <?php if($data['cattegory'] == 'awp'){ echo"selected=\"selected\" "; } ?>>Sniper</option>
          <option value="shotgun" <?php if($data['cattegory'] == 'shotgun'){ echo"selected=\"selected\" "; } ?>>Shotgun</option>
          <option value="machinegun" <?php if($data['cattegory'] == 'machinegun'){ echo"selected=\"selected\" "; } ?>>Machine Gun</option>
          <option value="handgun" <?php if($data['cattegory'] == 'handgun'){ echo"selected=\"selected\" "; } ?>>Hand Gun</option>
          <option value="melee" <?php if($data['cattegory'] == 'melee'){ echo"selected=\"selected\" "; } ?>>Melee</option>
          <option value="explosive" <?php if($data['cattegory'] == 'explosive'){ echo"selected=\"selected\" "; } ?>>Explosive</option>
          <option value="special" <?php if($data['cattegory'] == 'special'){ echo"selected=\"selected\" "; } ?>>Special</option>
      </select></td>
    </tr>
    <tr>
      <td>Mark</td>
      <td>:</td>
      <td><label for="mark"></label>
        <select name="mark" id="mark">
          <option value="hot" <?php if($data['mark'] == 'hot'){ echo"selected=\"selected\" "; } ?>>Hot</option>
          <option value="new" <?php if($data['mark'] == 'new'){ echo"selected=\"selected\" "; } ?> >New</option>
          <option value="regular" <?php if($data['mark'] == 'regular'){ echo"selected=\"selected\" "; } ?>>Regular</option>
        </select></td>
    </tr>
    <tr>
      <td>Type</td>
      <td>:</td>
      <td><?php if($data['tipe'] == 'gcash'){ echo"G-Cash"; }elseif($data['tipe'] == 'point'){ echo"Point"; }?> <input name="tipe" type="hidden" id="tipe" value="<?=$data['tipe'];?>" /></td>
    </tr>
    <tr>
      <td>Duration &amp; Price</td>
      <td>:</td>
      <td>
      <?php
	  if($data['tipe'] == 'gcash'){
	  ?>
          1 Day : 
          <input name="one_day" type="text" id="one_day" value="<?=$data['one_day'];?>" />
          <br />
          3 Day : 
            <input name="three_day" type="text" id="three_day" value="<?=$data['three_day'];?>" />
          <br />
          7 Day :
          <input name="seven_day" type="text" id="seven_day" value="<?=$data['seven_day'];?>" />
          <br />
          30 Day : 
          <input name="thirty_day" type="text" id="thirty_day" value="<?=$data['thirty_day'];?>" />
          <input name="point_unit" type="hidden" value="0" /><input name="point_price" type="hidden" value="0" />
      <?php
	  }elseif($data['tipe'] == 'point'){
	  ?>
      <input name="point_unit" type="text" id="point_unit" value="<?=$data['point_unit'];?>" size="3" maxlength="3" /> Unit : <input name="point_price" type="text" id="point_price" value="<?=$data['point_price'];?>" size="5" maxlength="5" /> Point 
      <input name="one_day" type="hidden" value="0" /><input name="three_day" type="hidden" value="0" /><input name="seven_day" type="hidden" value="0" /><input name="thirty_day" type="hidden" value="0" />
      <?php
	  }
	  ?>
        </td>
    </tr>
    <tr>
      <td>Damage</td>
      <td>:</td>
      <td><label for="damage"></label>
      <input name="damage" type="text" id="damage" value="<?=$data['damage'];?>" /></td>
    </tr>
    <tr>
      <td>Fire Speed</td>
      <td>:</td>
      <td><label for="fire_speed"></label>
      <input name="fire_speed" type="text" id="fire_speed" value="<?=$data['fire_speed'];?>" /></td>
    </tr>
    <tr>
      <td>Accuracy</td>
      <td>:</td>
      <td><label for="accuracy"></label>
      <input name="accuracy" type="text" id="akurasi" value="<?=$data['accuracy'];?>" /></td>
    </tr>
    <tr>
      <td>Ammo</td>
      <td>:</td>
      <td><label for="ammo_1"></label>
      <input name="ammo_1" type="text" id="ammo_1" value="<?=$data['ammo_1'];?>" size="2" maxlength="2" />
      / 
      <input name="ammo_2" type="text" id="ammo_2" value="<?=$data['ammo_2'];?>" size="3" maxlength="3" /></td>
    </tr>
    <tr>
      <td>V. Recoil</td>
      <td>:</td>
      <td><label for="v_recoil"></label>
      <input name="v_recoil" type="text" id="v_recoil" value="<?=$data['v_recoil'];?>" /></td>
    </tr>
    <tr>
      <td>H. Recoil</td>
      <td>:</td>
      <td><label for="h_recoil"></label>
      <input name="h_recoil" type="text" id="h_recoil" value="<?=$data['h_recoil'];?>" /></td>
    </tr>
    <tr>
      <td>Move Speed</td>
      <td>:</td>
      <td><label for="move_speed"></label>
      <input name="move_speed" type="text" id="move_speed" value="<?=$data['move_speed'];?>" /></td>
    </tr>
    <tr>
      <td>Range</td>
      <td>:</td>
      <td><label for="ranger"></label>
      <input name="ranger" type="text" id="ranger" value="<?=$data['ranger'];?>" /></td>
    </tr>
    <tr>
      <td>Status</td>
      <td>:</td>
      <td><select name="status" id="status">
        <option value="sell" <?php if($data['status'] == 'sell'){ echo"selected=\"selected\" "; } ?>>Sell</option>
        <option value="not_sell" <?php if($data['status'] == 'not_sell'){ echo"selected=\"selected\" "; } ?>>Not Sell</option>
      </select>
      <input name="id" type="hidden" id="id" value="<?=$id;?>" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Submit" /></td>
    </tr>
  </table>
</form>
</body>
</html>
<?php
}
?>